﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FazaDemo.BL.CM.CollectionMechanisms;

namespace FazaDemo.BL.Services_
{
    class NavTittleGenerator
    {
       
        public string GetTittle(string ecqText)
        {
            int firstTittleIndex = ecqText.IndexOf(" ") + 1;
            int tittleLength = ecqText.SkipTakeWhile((c, i) => i < firstTittleIndex, EndTittleCondition)
                .Count();
            return ecqText.Substring(firstTittleIndex, tittleLength);
        }

        private bool EndTittleCondition(char c)
        {
            return !Char.IsControl(c);
        }

    }
}
